package com.csw.shuanfa.SuanFa.huaWei;

import lombok.extern.slf4j.Slf4j;

import java.util.Scanner;

/**
 * 计算字符串最后一个单词的长度，单词以空格隔开。
 *
 * @author 1
 */
@Slf4j
public class WordLength {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int maxLength = 5000;
        String inputString = sc.next();
        if ("".equals(inputString)) {
            log.error("" + "输入不正确");
        } else if (inputString.length() > maxLength) {
            log.info("" + "长度太长");

        } else {
            String[] splitSz = inputString.split(" ");
            log.info("" + "最后一个单词长度是" + splitSz[splitSz.length - 1].length());

        }
    }
}
